package com.bright.ghj.overt.repository.primary;

import com.bright.ghj.overt.pojo.po.primary.Zt;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ZtRepository extends JpaRepository<Zt, Integer>, JpaSpecificationExecutor<Zt> {

    Zt getByZtId(String ztId);


    /**
     * 获取账套信息列表
     *
     * @param ztIds 账套id列表
     * @return 账套列表
     */
    @Query("from Zt where ztId in (:ztIds)")
    List<Zt> findByZtIds(@Param("ztIds") List<String> ztIds);

    @Query("from Zt where distNo like :distNo% order by ztId")
    List<Zt> findAllByDistNoOrderByZtId(@Param("distNo") String distNo);

    @Query("from Zt zt where zt.distNo like :distNo% order by zt.ztId")
    Page<Zt> findAllByDistNoOrderByZtId(@Param("distNo") String distNo, Pageable pageable);

    List<Zt> findAllByZthImport(String zthImport);

}